//
//  BaseTableViewController.swift
//  xinlangweibo
//
//  Created by 陈志强 on 15/11/8.
//  Copyright © 2015年 陈志强. All rights reserved.
//

import UIKit
class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {
    var userLogin = UserAccountViewModel().userLogin
    var visittorLigonView: VisitorLoginView?
    override func loadView() {
        userLogin ? super.loadView() : loadVisitorView()
    }
    private func loadVisitorView(){
        //view = VisitorLoginView()
        visittorLigonView = VisitorLoginView()
        visittorLigonView?.visitorDelegate = self
        view = visittorLigonView
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "visitorEillRegister")
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: .Plain, target: self, action: "visitorWillLongin")
    }
  
    func visitorEillRegister() {
        print("come on")
    }
    func visitorWillLongin() {
        let oaut = OAuthViewController()
        let nav = UINavigationController(rootViewController: oaut)
        presentViewController(nav, animated: true, completion: nil)
        print("come in")
        
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    
}
